/*
 * lab10B1.c
 * CSIS 248 Lab #10
 */
#define ANSWER_SIZE 10

int main() {
   int out1 = 0;
   const char* message1 = "Enter a positive number: ";
   const int length1 = 25;

   out1 = write( 1, message1, length1 );

   if ( out1 != length1 ){
	   const char* message2 = "Error in write to stdout\n";
	   const int length2 = 25;

	   write( 2, message2, length2 );
   }

   // read in a number from the keyboard
   char answer[ANSWER_SIZE] = { '\0' };
   int in1;

   in1 = read( 0, answer, ANSWER_SIZE );
   if (in1 < 0)
	   write( 2, "Read error!\n", 12 );

   // atoi converts an ASCII string of digits to an integer number
   int ans = atoi( answer );

   if (ans > 0)
	   write( 1, "Thank You!\n", 11);
   return 0;
}
